import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from "@vitejs/plugin-vue-jsx";

import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  base: '/ykf',
  server: {
    port: 8000,
    proxy: {
      '/api': {
        target: 'http://yms.iylyh.cn',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      },
      '/test': {
        target: 'http://41fcbc9a.r6.cpolar.top',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/test/, '')
      }
    }
  },
  resolve: {
    alias: {
      "@": path.join(__dirname, 'src'),
      "custom": path.join(__dirname, 'src/custom')
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@use "src/assets/styles/theme.scss";`
      }
    }
  },
  plugins: [vue(), vueJsx()],
})
